Job Ready Go by Haythem Balti

Job Ready Go by Haythem Balti

Author:Haythem Balti [Balti, Haythem]
Language: eng
Format: epub
ISBN: 9781119889830
Publisher: Wiley
Published: 2022-10-04T00:00:00+00:00


LISTING 16.13

Code to test the drink functionality

func main() { var d drink d.name = "Sprite" d.size = 24 d.display(true) }

This code creates a variable named d of type drink and then assigns name and size to drink. You then call computePrice, which will determine the price based on the assigned size:

Item Name: SPRITE Item Size: 24 Item Price: $3

Creating a side Struct

All the sides on our menu have the same price ($2). Listing 16.14 shows the side struct, which includes two fields, name and price.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.